package emulator.shell.GUI;

import java.awt.LayoutManager;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JToolBar;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import emulator.VicMain;

@SuppressWarnings("serial")
public class ToolBarWindow extends JPanel
{
	static Logger logger = LogManager.getLogger(VicMain.class.getName());

	protected JToolBar toolbar;

	public ToolBarWindow() {
		super();
	}

	public ToolBarWindow(LayoutManager layout) {
		super(layout);
	}

	public ToolBarWindow(boolean isDoubleBuffered) {
		super(isDoubleBuffered);
	}

	public ToolBarWindow(LayoutManager layout, boolean isDoubleBuffered) {
		super(layout, isDoubleBuffered);
	}

	public static JButton makeNavigationButton(String imageName, String toolTipText,
			String altText, ActionListener action_listener) {
				//Create and initialize the button.
				JButton button = new JButton();
				button.setToolTipText(toolTipText);
				button.addActionListener(action_listener);
				
				if (imageName != null) {                      //image found
					button.setIcon(new ImageIcon(imageName, altText));
				} else {                                     //no image found
					button.setText(altText);
					logger.error("Resource not found: " + imageName);
				}
			
				return button;
			}

}